<?php
$new_number="";
for($i=0;$i<4;$i++)
{
	$new_number.=dechex(rand(1,15));
}
session_start();
header("content-type:image/gif");
$_SESSION['new_number']=$new_number;
$num_image= imagecreatetruecolor(100,40) or die("Cannot Initialize new GD image stream");
$color    = imagecolorallocate($num_image,255,204,153);
$color2   = imagecolorallocate($num_image,rand(0,255),rand(0,255),rand(0,255));
for($i=0;$i<4;$i++)
{
	imageline($num_image,rand(0,180),rand(0,180),rand(0,30),rand(0,30),
        imagecolorallocate($num_image,rand(0,255),rand(0,255),rand(0,255)));
}
imagestring($num_image,5,rand(20,40),rand(10,20),$new_number,$color2); //添加随即文字到画布
imagegif($num_image);
imagedestroy($num_image);
?>